package com.ctshk.sapp.order.tour.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.order.tour.dto.SeriesOrderTouristCertificateDTO;
import com.ctshk.rpc.order.tour.req.SeriesOrderTouristCertificateAddReq;
import com.ctshk.rpc.order.tour.req.SeriesOrderTouristCertificateDeleteReq;
import com.ctshk.rpc.order.tour.req.SeriesOrderTouristCertificateListReq;
import com.ctshk.rpc.order.tour.service.ISeriesOrderTouristCertificateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 系列团证件文件 前端控制器
 * </p>
 *
 * @author 谭响
 * @since 2021-01-21
 */
@Api(value="证件文件", tags="证件文件")
@RestController
@RequestMapping("/series/order/tourist/certificate")
public class SeriesOrderTouristCertificateController extends BaseController {

    @DubboReference
    private ISeriesOrderTouristCertificateService iSeriesOrderTouristCertificateService;

    @ApiOperation(value = "添加", notes = "添加（旅客信息-上传证件）")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.ADD, operTitle = "旅客信息-上传证件", operDesc = "旅客信息-上传证件")
    @PostMapping("/add")
    public Result add(@RequestBody SeriesOrderTouristCertificateAddReq req) {
        req.setUserId(getCurrentUser(getRequest()).getId());
        return iSeriesOrderTouristCertificateService.add(req);
    }

    @ApiOperation(value = "列表", notes = "列表（旅客信息-上传证件-查询）")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "旅客信息-上传证件-查询", operDesc = "旅客信息-上传证件-查询")
    @PostMapping("/list")
    public Result<List<SeriesOrderTouristCertificateDTO>> list(@RequestBody SeriesOrderTouristCertificateListReq req) {
        req.setUserId(getCurrentUser(getRequest()).getId());
        return iSeriesOrderTouristCertificateService.list(req);
    }

    @ApiOperation(value = "删除", notes = "删除（旅客信息-上传证件-删除）")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.DELETE, operTitle = "旅客信息-上传证件-删除", operDesc = "旅客信息-上传证件-删除")
    @PostMapping("/delete")
    public Result<List<SeriesOrderTouristCertificateDTO>> delete(@RequestBody SeriesOrderTouristCertificateDeleteReq req) {
        req.setUserId(getCurrentUser(getRequest()).getId());
        return iSeriesOrderTouristCertificateService.delete(req);
    }


}
